import os

import pytest


class RunPytestMain:
    def case_all(self, file_path):
        if file_path == None:
            pytest.main('./')
        else:
            pytest.main([file_path])

    def case_file(self, param, file_path):
        if param == None:
            pytest.main([file_path])
        elif file_path == None:
            pytest.main([param], './')
        else:
            pytest.main([param, file_path])

    def case_file_report(self, file_path1):
        pytest.main(['-s', '-q', '--alluredir', 'G:/APITESTV1.0/Report/Result', file_path1])
        os.system("G:/Code/venv/Lib/site-packages/allure-2.13.8/bin/allure.bat "
                  "generate "
                  "G:/APITESTV1.0/Report/Result "
                  "-c -o "
                  "G:/APITESTV1.0/Report/html")


runCase = RunPytestMain()

if __name__ == "__main__":
    run = RunPytestMain()
    # run.case_all()
    run.case_file('-s', '../')
